#coding=utf-8
from uliweb import expose
from generic.views import View

def __begin__():
    from uliweb import function
    return function('require_login')()

@expose('/config/tx', restful=True)
class TxView(View):
    model = 'tx'
    layout = 'config_tx_layout.html'
    add_button_text = '增加条线'
    
    def _get_title(self, action, obj=None):
        if action == 'add':
            return '增加条线'
        elif action == 'edit':
            return u'编辑条线:' + obj.name
        elif action == 'view':
            return u'查看条线:' + obj.name
        
    def __begin__(self):
        if not request.user.is_superuser:
            error('你不是超级用户不能进行这项操作！')
        
    @expose('<id>')
    def view(self, id):
        return super(TxView, self).view(id)
    